package com.wf.redis;

import redis.clients.jedis.Jedis;

/**
 * @author wufei
 * @date 2018/3/20/020 14:33
 */
public class CallLua {



    public static void main(String[] args) throws Exception {
        Jedis jedis = RedisManager.getJedis();
        String lua = "redis.call('set','name','jackson1')\n" +
                "local value = redis.call('get','name')\n" +
                "return value";
        Object eval = jedis.eval(lua);
        System.out.println(eval.toString());

        String sha = jedis.scriptLoad(lua);
        System.out.println("sha:"+sha);
        Object evalsha = jedis.evalsha(sha);
        System.out.println(evalsha.toString());
    }
}


